import Authorization.User;
import Authorization.UserStorage;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import static org.junit.Assert.*;
/**
 * Created by:
 * User: Igor Martynovich and Guzenko Igor
 * Date: 20.11.13
 */
public class TestUserStorage {
    UserStorage storage;
    @Before
    public void initStorage() throws IOException {
      storage = new UserStorage();
    }

    @Test
    public void testIsUserValid() throws IOException {
        User validUser = new User("log","pass");
        assertTrue("True",storage.isUserValid(validUser));
    }

    @Test
    public void testIsUserValid2(){
        User notValidUser = new User("00000","000000");
        assertFalse("False",storage.isUserValid(notValidUser));
    }

    @Test
    public void testIsUserExists() throws IOException {
        String existsLogin ="log";
        assertTrue("Exists",storage.isUserExist(existsLogin));
    }

    public void testIsUserExists2() throws IOException {
        String notExistsLogin = "0000000";
        assertFalse("Not exists",storage.isUserExist(notExistsLogin));
    }
}
